package com.bindapp.util;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by tom055 on 2018/6/24.
 */

public class PreferencesUtil {

    private SharedPreferences mShared = null;
    private Context mContext = null;
    private static PreferencesUtil mInstance = null;

    private String EzTokenKey="EzTokenKey";

    public static PreferencesUtil getInstance(Context context){
        if(null == mInstance && null != context){
            mInstance = new PreferencesUtil(context.getApplicationContext());
        }
        return mInstance;
    }

    private PreferencesUtil(Context context){
        mContext = context;
        mShared = mContext.getSharedPreferences("com.fkapp", Context.MODE_PRIVATE);
    }

    public void setEzToken(String token){
        SharedPreferences.Editor editor = mShared.edit();
        editor.putString(EzTokenKey,token);
        editor.commit();
    }


    public void setCookie(String cookie){
        SharedPreferences.Editor editor = mShared.edit();
        editor.putString("cookie",cookie);
        editor.commit();
    }
    public String getCookie(){
        return mShared.getString("cookie","");
    }

    public void setPhonenum(String phone){
        SharedPreferences.Editor editor = mShared.edit();
        editor.putString("phone",phone);
        editor.commit();
    }
    public String getPhonenum(){
        return mShared.getString("phone","");
    }

    public void setPassword(String phone){
        SharedPreferences.Editor editor = mShared.edit();
        editor.putString("password",phone);
        editor.commit();
    }
    public String getPassword(){
        return mShared.getString("password","");
    }

}
